/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ac.settings;

/**
 *
 * @author ismail
 */
public interface sqlQuerys {

    //<editor-fold defaultstate="collapsed" desc="inventory">
    final static String SQL_inventoryB
            = " select "
            + "   products.id as id    "
            + "   ,products.name as name   "
            + "   ,products_in_balance.balance as balance    "
            + "   ,products_in_balance.inventory_id as inventory_id    "
            + "   ,products_in_balance.product_id as product_id  "
            + "    from products_in_balance    "
            + "   INNER JOIN products  "
            + "   ON products.id =products_in_balance.product_id    ";

    final static String SQL_inventoryStatus = " select "
            + "               products.id as p_id, "
            + "               products.name as p_name, "
            + "               products.code as p_code, "
            + "               products.image as p_image, "
            + "               products.buy_price_from as p_buy_price_from, "
            + "               products.buy_price_to as p_buy_price_to, "
            + "               products.sell_price_from as p_sell_price_from, "
            + "               products.sell_price_to as p_sell_price_to, "
            + "               products.max_limit as p_max_limit, "
            + "               products.min_limit as p_min_limit, "
            + "               products.desc as p_desc, "
            + "               addstree.title as cate_title, "
            + "               products_balance.balance as balance , "
            + "               products_in_balance.balance as inv_balance, "
            + "               addstreeFrob.title as inv_title "
            + "                from  products_in_balance"
            + "                left join products "
            + "               on products_in_balance.product_id =products.id "
            + "              inner join addstree "
            + "              on products.cat_id=addstree.id "
            + "               left join products_balance "
            + "               on products_balance.product_id =products.id "
            + "              left join addstree addstreeFrob "
            + "               on products_in_balance.inventory_id =addstreeFrob.id  ";

    final static String SQL_outOrderAll = "select"
            + " inventory_order_output.id as inventory_order_output_id  "
            + " ,inventory_order_output.code as inventory_order_output_code  "
            + " ,inventory_order_output.client as inventory_order_output_client  "
            + " ,inventory_order_output.date as inventory_order_output_date  "
            + " ,inventory_order_output.status as inventory_order_output_status  "
            + " ,sales_items.id as sales_items_id   "
            + " ,sales_items.price as sales_items_price  "
            + " ,sales_items.product as sales_items_product  "
            + " ,sales_items.product_blance as sales_items_product_blance  "
            + " ,sales_items.quantity_type as sales_items_quantity_type  "
            + " ,sales_items.quantity as sales_items_quantity  "
            + " ,sales_items.inventory as sales_items_inventory  "
            + " ,sales_items.notes as sales_items_notes  "
            + " ,sales_items.inventory_order_id as sales_items_inventory_order_id  "
            + " , clients_data.name as clint_name "
            + " ,adds2.title as quantity_type_title "
            + " ,addstree.title as inventory_title  "
            + " ,products.name as pro_name "
            + " from inventory_order_output  "
            + " INNER JOIN sales_items  "
            + " ON inventory_order_output.id =sales_items.inventory_order_id  "
            + " INNER JOIN clients_data  "
            + " ON inventory_order_output.client =clients_data.id  "
            + " INNER JOIN products  "
            + " ON sales_items.product =products.id "
            + " INNER JOIN adds adds2 "
            + " ON sales_items.quantity_type =adds2.id  "
            + " INNER JOIN addstree  "
            + " ON addstree.id =sales_items.inventory  "
            + "";

    final static String SQL_outOrderFile = SQL_outOrderAll
            + " where inventory_order_output.id=";

//</editor-fold>
    //<editor-fold defaultstate="collapsed" desc="inventoryIN">
    final static String SQL_InOrderAll = "select "
            + " inventory_order_input.id as inventory_order_input_id   "
            + " ,inventory_order_input.code as inventory_order_input_code   "
            + " ,inventory_order_input.client as inventory_order_input_client   "
            + " ,inventory_order_input.date as inventory_order_input_date   "
            + " ,inventory_order_input.status as inventory_order_input_status   "
            + " ,bay_items.id as bay_items_id   "
            + " ,bay_items.price as bay_items_price   "
            + " ,bay_items.product as bay_items_product   "
            + " ,bay_items.product_blance as bay_items_product_blance   "
            + ""
            + " ,bay_items.quantity_type as bay_items_quantity_type   "
            + " ,bay_items.quantity as bay_items_quantity   "
            + " ,bay_items.inventory as bay_items_inventory   "
            + " ,bay_items.notes as bay_items_notes   "
            + " ,bay_items.inventory_order_id as bay_items_inventory_order_id   "
            + " , clients_data.name as clint_name  "
            + " ,adds2.title as quantity_type_title  "
            + " ,addstree.title as inventory_title   "
            + " ,products.name as pro_name  "
            + " from inventory_order_input   "
            + " INNER JOIN bay_items   "
            + " ON inventory_order_input.id =bay_items.inventory_order_id   "
            + " INNER JOIN clients_data   "
            + " ON inventory_order_input.client =clients_data.id   "
            + " INNER JOIN products   "
            + " ON bay_items.product =products.id  "
            + " INNER JOIN adds adds2  "
            + " ON bay_items.quantity_type =adds2.id   "
            + " INNER JOIN addstree   "
            + " ON addstree.id =bay_items.inventory ";

    final static String SQL_InOrderFile = SQL_InOrderAll + " where inventory_order_input.id=";

//</editor-fold>
    //<editor-fold defaultstate="collapsed" desc="Sell">
    final static String SQL_SellMoveAllShort = " select sales.id as id    "
            + "   ,sales.code as code    "
            + "   ,sales.date as date    "
            + "   ,sales_items.quantity as quantity  "
            + "   ,sales_items.unity_pric as unity_pric "
            + "   ,sales_items.price as price  "
            + "    from sales    "
            + "   INNER JOIN sales_items  "
            + "   ON sales.id =sales_items.bill_id  "
            + "   LEFT JOIN adds adds1  "
            + "   ON sales.payType =adds1.id  "
            + "   INNER JOIN adds adds2   "
            + "   ON sales_items.quantity_type =adds2.id    "
            + "   INNER JOIN addstree    "
            + "   ON addstree.id =sales_items.inventory ";

    final static String SQL_SellMoveAll = "select   "
            + "sales.id as salesid,  "
            + "sales.code as code,  "
            + "sales.client_title as client_title  "
            + ",sales.`date` as date  "
            + ",adds.title as payType_title  "
            + ",sales.status as status  "
            + ",sales.rowstatus as rowstatus  "
            + ",sales_items.id as  sales_items_id  "
            + ",sales_items.product_title as product_title  "
            + ",adds2.title as quantity_type_title  "
            + ",sales_items.quantity as quantity  "
            + ",sales_items.unity_pric as unity_pric  "
            + ",sales_items.price as price  "
            + ",adds3.title as inventory_title  "
            + ",sales_items.notes as notes  "
            + ",sales_items.rowstatus as sales_items_rowstatus  "
            + "from sales  "
            + "    INNER JOIN sales_items   "
            + "             ON sales.id =sales_items.bill_id   "
            + "INNER JOIN adds adds   "
            + "             ON sales.`payType` =adds.id   "
            + "INNER JOIN adds adds2  "
            + "             ON sales_items.`quantity_type` =adds2.id   "
            + "INNER JOIN addstree adds3  "
            + "             ON sales_items.`inventory` =adds3.id ";

    final static String SQL_SellMoveFile = SQL_SellMoveAll + " where sales.id=";

//</editor-fold>
    //<editor-fold defaultstate="collapsed" desc="Sell">
    final static String SQL_PRICVIEWMoveAll = "   select        "
            + " priceview.id as priceview_id     "
            + "  ,priceview.code as priceview_code     "
            + "  ,priceview.client_title as client_title   "
            + "  ,priceview.date as priceview_date     "
            + "  ,adds1.title as paytyp_title   "
            + "  ,priceview.status as priceview_status    "
            + "  ,sales_items.product_title as product_name   "
            + "  ,adds2.title as quantity_type_title    "
            + "  ,sales_items.quantity as sales_items_quantity    "
            + "  ,sales_items.unity_pric as sales_items_unity_pric  "
            + "  ,sales_items.price as sales_items_price   "
            + "  ,addstree.title as inventory_title   "
            + "  ,sales_items.notes as sales_items_notes     "
            + "  ,sales_items.inventory_order_id as sales_items_inventory_order_id    "
            + "  ,sales_items.quantity_type as sales_items_quantity_type    "
            + "  ,sales_items.inventory as sales_items_inventory   "
            + "  ,sales_items.product as sales_items_product    "
            + "  ,priceview.client as priceview_client   "
            + "  ,priceview.payType as priceview_payType      "
            + "   from priceview     "
            + "  INNER JOIN sales_items   "
            + "  ON priceview.id =sales_items.pricview_id   "
            + "  LEFT JOIN adds adds1   "
            + "  ON priceview.payType =adds1.id   "
            + "  INNER JOIN adds adds2    "
            + "  ON sales_items.quantity_type =adds2.id     "
            + "  INNER JOIN addstree     "
            + "  ON addstree.id =sales_items.inventory  ";

    final static String SQL_PRICVIEWMoveFile = SQL_PRICVIEWMoveAll + " where priceview.id=";

//</editor-fold>
    //<editor-fold defaultstate="collapsed" desc="bay">
   /* final static String SQL_BAYMoveAll = " select bay.id as bay_id    "
     + "   ,bay.code as bay_code    "
     + "   ,bay.client_title as client_title  "
     + "   ,bay.date as bay_date    "
     + "   ,adds1.title as paytyp_title  "
     + "   ,bay.status as bay_status   "
     + "   ,bay_items.product_title as product_name  "
     + "   ,adds2.title as quantity_type_title   "
     + "   ,bay_items.quantity as bay_items_quantity   "
     + "   ,bay_items.unity_pric as bay_items_unity_pric "
     + "   ,bay_items.price as bay_items_price  "
     + "   ,addstree.title as inventory_title  "
     + "   ,bay_items.notes as bay_items_notes    "
     + "   ,bay_items.inventory_order_id as bay_items_inventory_order_id   "
     + "   ,bay_items.quantity_type as bay_items_quantity_type   "
     + "   ,bay_items.inventory as bay_items_inventory  "
     + "   ,bay_items.product as bay_items_product   "
     + "   ,bay.client as bay_client  "
     + "    ,bay.payType as bay_payType     "
     + "    from bay    "
     + "   INNER JOIN bay_items  "
     + "   ON bay.id =bay_items.bill_id  "
     + "   LEFT JOIN adds adds1  "
     + "   ON bay.payType =adds1.id  "
     + "   INNER JOIN adds adds2   "
     + "   ON bay_items.quantity_type =adds2.id    "
     + "   INNER JOIN addstree    "
     + "   ON addstree.id =bay_items.inventory ";

     */
    final static String SQL_BAYMoveAll = "select   "
            + "bay.id as bayid,  "
            + "bay.code as code,  "
            + "bay.client_title as client_title  "
            + ",bay.`date` as date  "
            + ",adds.title as payType_title  "
            + ",bay.status as status  "
            + ",bay.rowstatus as rowstatus  "
            + ",bay_items.id as  bay_items_id  "
            + ",bay_items.product_title as product_title  "
            + ",adds2.title as quantity_type_title  "
            + ",bay_items.quantity as quantity  "
            + ",bay_items.unity_pric as unity_pric  "
            + ",bay_items.price as price  "
            + ",adds3.title as inventory_title  "
            + ",bay_items.notes as notes  "
            + ",bay_items.rowstatus as bay_items_rowstatus  "
            + "from bay  "
            + "    INNER JOIN bay_items   "
            + "             ON bay.id =bay_items.bill_id   "
            + "INNER JOIN adds adds   "
            + "             ON bay.`payType` =adds.id   "
            + "INNER JOIN adds adds2  "
            + "             ON bay_items.`quantity_type` =adds2.id   "
            + "INNER JOIN addstree adds3  "
            + "             ON bay_items.`inventory` =adds3.id ";

    final static String SQL_BAYMoveFile = SQL_BAYMoveAll
            + " where bay.id=";

//</editor-fold>
    //<editor-fold defaultstate="collapsed" desc="Clinete">
    final static String SQL_ClineteAll = "select "
            + "clients_data.id as c_id, "
            + "clients_data.name as c_name, "
            + "clients_data.type as c_type, "
            + "clients_data.code as c_code, "
            + "clients_data.address as c_address, "
            + "clients_data.mobilephone as c_mobilephone, "
            + "clients_data.phone as c_phone, "
            + "clients_data.email as c_email, "
            + "clients_data.balancelimit as c_balancelimit, "
            + "addstree.title as cat_title, "
            + "adds1.title as pric_sell_Type_title, "
            + "adds2.title as pric_by_Type_title, "
            + "clients_balance.balance as balance "
            + "from "
            + "clients_data "
            + "INNER JOIN addstree "
            + "ON clients_data.cat_id =addstree.id "
            + "INNER JOIN adds adds1 "
            + "ON clients_data.`pric_sell_Type` =adds1.id "
            + "INNER JOIN adds adds2 "
            + "ON clients_data.`pric_bay_type` =adds2.id "
            + "LEFT JOIN clients_balance "
            + "ON clients_balance.`client_id`=clients_data.id ";
    final static String SQL_ClineteFile = SQL_ClineteAll + " WHERE clients_data.id=";

//</editor-fold>
    //<editor-fold defaultstate="collapsed" desc="Products">
    final static String SQL_ProductsAll = "select "
            + "  products.id as p_id, "
            + "  products.name as p_name, "
            + "  products.code as p_code, "
            + "  products.image as p_image, "
            + "  products.buy_price_from as p_buy_price_from, "
            + "  products.buy_price_to as p_buy_price_to, "
            + "  products.sell_price_from as p_sell_price_from, "
            + "  products.sell_price_to as p_sell_price_to, "
            + "  products.max_limit as p_max_limit, "
            + "  products.min_limit as p_min_limit, "
            + "  products.desc as p_desc, "
            + "  addstree.title as cate_title, "
            + "  products_balance.balance as balance , "
            + "  products_in_balance.balance as inv_balance, "
            + "  addstreeFrob.title as inv_title "
            + " from products "
            + " inner join addstree "
            + " on products.cat_id=addstree.id "
            + "  left join products_balance "
            + "  on products_balance.product_id =products.id "
            + "  left join products_in_balance "
            + "  on products_in_balance.product_id =products.id "
            + " left join addstree addstreeFrob "
            + "  on products_in_balance.inventory_id =addstreeFrob.id ";

    final static String SQL_ProductsFile = SQL_ProductsAll
            + "where products.id=";

    final static String SQL_products_move_history = "select * "
            + " from products_move_history "
            + "";

//</editor-fold>
    //<editor-fold defaultstate="collapsed" desc="treasury">
    final static String SQL_treasuryInAll = "select  "
            + "   treasury_in.id as ti_id  "
            + "   ,treasury_in.client as ti_client  "
            + "   ,treasury_in.code as ti_code  "
            + "   ,treasury_in.`date` as ti_date  "
            + "   ,treasury_in.`Official` as ti_Official  "
            + "   ,treasury_in.baytype as ti_baytype  "
            + "   ,treasury_in.amount as ti_amount  "
            + "   ,treasury_in.`more` as ti_more  "
            + "   ,treasury_in.`treasury` as ti_treasury  "
            + "   ,treasury_in.`client_title` as cinet_title  "
            + "   ,treasury_in.`rowstatus` as rowstatus  "
            + "   ,adds1.title as Official_title  "
            + "   ,adds2.title as treasury_title  "
            + "   ,adds3.title as paytype_title  "
            + "   from treasury_in inner join clients_data  "
            + "   on clients_data.id=treasury_in.client  "
            + "   inner join addstree adds1  "
            + "   on adds1.id=treasury_in.`Official`  "
            + "   inner join addstree adds2  "
            + "   on adds2.id=treasury_in.treasury  "
            + "   inner join adds  adds3  "
            + "   on adds3.id=treasury_in.baytype";
    final static String SQL_treasuryIn_File = SQL_treasuryInAll + " where treasury_in.id=";

//</editor-fold>
    //<editor-fold defaultstate="collapsed" desc="treasury_movie">
    final static String SQL_treasury = "select  "
            + "treasury_balance.id as id "
            + ",addstree.title as treasury_title "
            + ",treasury_balance.balance as  balance "
            + ",treasury_balance.treasury_id as treasury_id "
            + " from treasury_balance "
            + " join  addstree  "
            + " on addstree.id=treasury_balance.treasury_id";

    final static String SQL_treasury_Movies_All
            = "select  "
            + "treasury_movies.id as my_id "
            + ",treasury_movies.`date` as my_date "
            + ",treasury_movies.`code` as my_code "
            + ",treasury_movies.`type` as my_type "
            + ",treasury_movies.amount as my_amonut "
            + ",adds.title as treasury_title "
            + ",adds2.title as offcial_title "
            + ",treasury_movies.`more` as my_more "
            + ",treasury_movies.rowstatus as my_rowstatus "
            + ",treasury_movies.offcial as my_offcial "
            + ",treasury_movies.treasury_id as my_treasury_id "
            + " from treasury_movies "
            + " inner join addstree adds "
            + " on adds.id=treasury_movies.treasury_id "
            + " inner join addstree adds2 "
            + " on adds2.id=treasury_movies.offcial";

    final static String SQL_treasury_Movies_file = SQL_treasury_Movies_All + " where treasury_movies.id=";
//</editor-fold>

    //<editor-fold defaultstate="collapsed" desc="treasury">
    final static String SQL_treasuryOutAll = "select "
            + "treasury_out.id as ti_id "
            + ",treasury_out.client_title as cinet_title "
            + ",treasury_out.code as ti_code "
            + ",treasury_out.`date` as ti_date "
            + ",treasury_out.`Official` as ti_Official "
            + ",treasury_out.baytype as ti_baytype "
            + ",treasury_out.amount as ti_amount "
            + ",treasury_out.`more` as ti_more "
            + ",treasury_out.`treasury` as ti_treasury "
            + ",treasury_out.`rowstatus` as rowstatus "
            + ",adds1.title as Official_title "
            + ",adds2.title as treasury_title "
            + "from treasury_out inner join clients_data "
            + "on clients_data.id=treasury_out.client "
            + "inner join addstree adds1 "
            + "on adds1.id=treasury_out.`Official` "
            + "inner join addstree adds2 "
            + "on adds2.id=treasury_out.treasury "
            + "";

    final static String SQL_treasuryOut_File
            = SQL_treasuryOutAll + " where treasury_out.id=";

//</editor-fold>
    //<editor-fold defaultstate="collapsed" desc="treasuryEX">
    final static String SQL_treasuryEX_File = "select  "
            + "treasury_otherex.id as ex_id "
            + ",treasury_otherex.code as ex_code "
            + ",treasury_otherex.amount as ex_amount "
            + ",treasury_otherex.`date` as ex_date "
            + ",adds3.title as exfor_title "
            + ",adds2.title as official_title "
            + ",adds1.title as treasury_title "
            + ",treasury_otherex.`more` as ex_more "
            + ",treasury_otherex.treasury_id as ex_treasury_id "
            + ",treasury_otherex.official_id as ex_official_id "
            + ",treasury_otherex.exfor_id as ex_exfor_id "
            + "from treasury_otherex "
            + "left join addstree adds1 "
            + "on treasury_otherex.treasury_id=adds1.id "
            + "left join addstree adds2 "
            + "on treasury_otherex.official_id =adds2.id "
            + "left join addstree adds3 "
            + "on treasury_otherex.exfor_id=adds3.id where treasury_otherex.id=";

    final static String SQL_treasuryEX_All = "select  "
            + "treasury_otherex.id as ex_id "
            + ",treasury_otherex.code as ex_code "
            + ",treasury_otherex.amount as ex_amount "
            + ",treasury_otherex.`date` as ex_date "
            + ",adds3.title as exfor_title "
            + ",adds2.title as official_title "
            + ",adds1.title as treasury_title "
            + ",treasury_otherex.`more` as ex_more "
            + ",treasury_otherex.treasury_id as ex_treasury_id "
            + ",treasury_otherex.official_id as ex_official_id "
            + ",treasury_otherex.exfor_id as ex_exfor_id "
            + "from treasury_otherex "
            + "left join addstree adds1 "
            + "on treasury_otherex.treasury_id=adds1.id "
            + "left join addstree adds2 "
            + "on treasury_otherex.official_id =adds2.id "
            + "left join addstree adds3 "
            + "on treasury_otherex.exfor_id=adds3.id ";
//</editor-fold>

    //<editor-fold defaultstate="collapsed" desc="SQL_installment">
    final static String SQL_installment
            = "select  "
            + "installment.id as id, "
            + "installment.code as code, "
            + "installment.move_id as move_id, "
            + "installment.c_title as c_title "
            + ",installment.move_type as move_type "
            + ",installment_items.`number` "
            + ",installment_items.`date` "
            + ",installment_items.amount "
            + ",installment_items.status "
            + ",installment.c_id as c_id "
            + "from installment "
            + "left join installment_items "
            + "on installment_items.`Installment_id`=installment.id ";

    final static String SQL_installmentHome
            = "select  "
            + "installment_items.id as id "
            + ",installment.code as code "
            + ",installment_items.`number` as number "
            + ",installment.c_title as c_title "
            + ",installment_items.`date` "
            + ",installment_items.amount "
            + ",installment.move_id as move_id "
            + ",installment.move_type as move_type "
            + "from installment "
            + "left join installment_items "
            + "on installment_items.`Installment_id`=installment.id ";

    //</editor-fold>
}
